//
//  UIView+TL_Size.m
//  WXReader
//
//  Created by Andrew on 2021/12/15.
//  Copyright © 2021 Andrew. All rights reserved.
//

#import "UIView+TL_Size.h"

@implementation UIView (TL_Size)

- (CGFloat)wx_left {
    return self.frame.origin.x;
}

- (void)setWx_left:(CGFloat)x {
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (CGFloat)wx_top {
    return self.frame.origin.y;
}

- (void)setWx_top:(CGFloat)y {
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}

- (CGFloat)wx_right {
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setWx_right:(CGFloat)right {
    CGRect frame = self.frame;
    frame.origin.x = right - frame.size.width;
    self.frame = frame;
}

- (CGFloat)wx_bottom {
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setWx_bottom:(CGFloat)bottom {
    CGRect frame = self.frame;
    frame.origin.y = bottom - frame.size.height;
    self.frame = frame;
}

- (CGFloat)wx_width {
    return self.frame.size.width;
}

- (void)setWx_width:(CGFloat)width {
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

- (CGFloat)wx_height {
    return self.frame.size.height;
}

- (void)setWx_height:(CGFloat)height {
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

- (CGFloat)wx_centerX {
    return self.center.x;
}

- (void)setWx_centerX:(CGFloat)centerX {
    self.center = CGPointMake(centerX, self.center.y);
}

- (CGFloat)wx_centerY {
    return self.center.y;
}

- (void)setWx_centerY:(CGFloat)centerY {
    self.center = CGPointMake(self.center.x, centerY);
}

- (CGPoint)wx_origin {
    return self.frame.origin;
}

- (void)setWx_origin:(CGPoint)origin {
    CGRect frame = self.frame;
    frame.origin = origin;
    self.frame = frame;
}

- (CGSize)wx_size {
    return self.frame.size;
}

- (void)setWx_size:(CGSize)size {
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}

@end
